﻿using IPluginInterface;
using Qting.AOI.Serialize;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MesPlugin
{
    [Serializable]
    public class MesPlugin : MarshalByRefObject, IAoiPlugin
    {
        public string Tag
        {
            get;
            private set;
        }

        public Version Version
        {
            get;
            private set;
        }

        public string Description
        {
            get;
            private set;
        }

        public MesPlugin()
        {
            Tag = "Mes插件测试";
            Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
            Description = "测试测测试测测试测测试测测试测测试测测试测测试测测试测测试测测试测测试测测试测测试测测试测";
        }
        public PluginResult Init(params object[] args)
        {
            return new PluginResult();
        }

        public PluginResult Start(ref AoiPcbs aoiPcbs, bool bDual = false, params object[] args)
        {
            aoiPcbs.pcb_name = "Start";
            return new PluginResult();
        }

        public PluginResult BeforeProductIn(ref AoiPcbs aoiPcbs, bool bDual = false, params object[] args)
        {
            aoiPcbs.pcb_name = "BeforeProductIn";
            return new PluginResult();
        }
        public PluginResult ProductIn(ref AoiPcbs aoiPcbs, bool bDual = false, params object[] args)
        {
            aoiPcbs.pcb_name = "ProductIn";
            //string sn = aoiPcbs.m_barcodeList.Count > 0 ? aoiPcbs.m_barcodeList[0].strBarcode : "";
            return new PluginResult();
        }

        public PluginResult AfterProductIn(ref AoiPcbs aoiPcbs, bool bDual = false, params object[] args)
        {
            aoiPcbs.pcb_name = "AfterProductIn";
            return new PluginResult();
        }
        public PluginResult BeforeProductOut(ref AoiPcbs aoiPcbs, bool bDual = false, params object[] args)
        {
            aoiPcbs.pcb_name = "BeforeProductOut";
            return new PluginResult();
        }

        public PluginResult ProductOut(ref AoiPcbs aoiPcbs, bool bDual = false, params object[] args)
        {
            aoiPcbs.pcb_name = "ProductOut";
            return new PluginResult();
        }

        public PluginResult AfterProductOut(ref AoiPcbs aoiPcbs, bool bDual = false, params object[] args)
        {
            aoiPcbs.pcb_name = "AfterProductOut";
            return new PluginResult();
        }

        public PluginResult Done(ref AoiPcbs aoiPcbs, bool bDual = false, params object[] args)
        {
            aoiPcbs.pcb_name = "Done";
            return new PluginResult();
        }

        public void OpenSettingForm(params object[] args)
        {
            MessageBox.Show("打开设置界面配置相关的参数");
        }

        public PluginResult YiNing(ref AoiPcbs spiPcbs, params object[] args)
        {
            throw new NotImplementedException();
        }

        public void Dispose()
        {
           
        }
    }
}
